<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    Function.prototype.before = function( beforefn ){
        var __self = this;
        return function(){
            beforefn.apply( this, arguments ); // (1)
            return __self.apply( this, arguments ); // (2)
        }
    }
    var func = function( param ){
        console.log( param ); // 输出： {a: "a", b: "b"}
    }
    func = func.before( function( param ){
        param.b = 'b';
    });
    func( {a: 'a'} );
</script>

</body>
</html>